Ext.define('Jee.Util', {
    singleton: true,  
    formObjToModel:function(formObj){
      var data = {};
      if(formObj){
    	  for(var key in formObj){
    		  var keys = key.split('.');
    		  var currentObject=data;
    		  for(var i=0;i<keys.length;i++){	  
    			  if(i==keys.length-1){
    				  currentObject[keys[i]] = formObj[key];
    			  }else{
    				  currentObject[keys[i]]={};
    			  }
    		  }
    	  }
      }
      return data;
    },
    modelToFormObj:function(model){
    	function   buildFormValue(model,formValue,beforeKey){
		    if(Ext.isObject(model)){
		        for(var key in  model){  
		             if(Ext.isObject(model[key])){
		                 var currentKey = beforeKey+key+".";
		                 buildFormValue(model[key],formValue,currentKey);
		             }else{
		            	 if(!Ext.isArray(model[key])){
		            		 formValue[beforeKey+key] = model[key];
		            	 } 
		             }
		        }
		    }
		}
     var formValue = {};
     buildFormValue(model,formValue,'');
     return formValue;
    },
    
    
    
});